<template>
	<view class="teamDetail-container">
		<view class="detail-title">
			{{ teamDetailList.name }}
		</view>
		<view class="detail-publisher-info">
			<view>
				<span>发布人</span><span class="publisher"> {{ teamDetailList.teacher.nickname }} </span><span>{{ teamDetailList.createtime }}</span>
			</view>
			<view style="margin-top: 10rpx;">
				<button class="cu-btn round bg-blue sm" @tap="$openrul(`/pages/currentTeamList/currentTeamList`)">加入团队</button>
			</view>
		</view>
		<!-- 文字内容 -->
		<view class="detail-content">
			<!-- 富文本内容 -->
			<rich-text class="rich-text" :nodes="teamDetailList.detail"></rich-text>
		</view>
		<view class="readNumber">
			阅读量：{{ teamDetailList.read_num }}
		</view>
		<view class="publisher-info">
			<view class="publisher-info-left">
				<view class="cu-avatar round"
					:style="{ 'background-image': `url(${domainPrefix + teamDetailList.teacher.avatar})` }"></view>
				<view class="name">
					{{ teamDetailList.teacher.nickname }}
				</view>
			</view>
			<!-- <view class="publisher-info-right">
				<view class="share-icon">
					<text class="lg text-gray cuIcon-share"></text>
					<text>分享</text>
				</view>
				<view class="share-icon">
					<text class="lg text-gray cuIcon-favor"></text>
					<text>收藏</text>
				</view>
				<view class="share-icon">
					<text class="lg text-gray cuIcon-like"></text>
					<text>点赞</text>
				</view>
				<view>

				</view>
				<view></view>

			</view> -->
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			domainPrefix:'',
			teamTaskDetailID:null,
			teamDetailList:[]
		};
	},
	onLoad(query) {
		let token = JSON.parse(uni.getStorageSync('vuexvuex'))
		var parsedData = JSON.parse(token.value);
		var tokenValue = parsedData.userinfo.token;
		let domainPrefix = this.$myHttp.config.baseUrl;
		this.domainPrefix = domainPrefix.replace(/\/$/, '');
		// 从 query 中获取传递的参数
		this.teamTaskDetailID = query.id || '';
		this.getTeamTaskDetail()
	
	},
	methods:{
		async getTeamTaskDetail(){
			let res = await this.$myHttp.post({
				
				url: this.$myHttp.urlMap.teamTaskDetail,
				data: {
					id:this.teamTaskDetailID
				}
			})
			this.teamDetailList = res.data.detail
			console.log('res: ', res)
		},
	}
}
</script>

<style lang="scss">
	.rich-text{
		word-break: break-all;
		white-space: pre-line;
	}
.publisher-info-right {
	display: flex;


	.share-icon {
		display: flex;
		margin-right: 16rpx;
		align-items: center;
		justify-content: center;
		flex-direction: column;
	}
}

.name {
	margin-left: 10rpx;
}

.publisher-info-left {
	display: flex;
	align-items: center;

}

.publisher-info {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 20rpx;
}

.readNumber {
	margin-top: 20rpx;
	font-size: 14px;
	color: #B0ABAB;
}

.detail-content {
	font-size: 14px;
	margin-top: 20rpx;
}

.detail-title {
	font-size: 18px;
	font-weight: 700;
	margin-bottom: 10rpx;
}

.publisher {
	color: #539AFF;
	margin-right: 10rpx;
	margin-left: 10rpx;
	font-weight: 700;
}

.detail-publisher-info {
	font-size: 14px;
	margin-top: 10rpx;
	color: #B0ABAB;
}

.teamDetail-container {
	background-color: #fff;
	padding: 24rpx;
}</style>
